package com.homestead.controller;

import com.homestead.resp.CommonResponse;
import com.homestead.utils.CommonResponseUtil;
import com.homestead.vo.CouponsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping("/coupon")
@Api(tags = {"优惠券基础信息"})
public class CouponController {

    @GetMapping("/getOneByCouponId")
    @ApiOperation("根据主键id获取coupon")
    public CommonResponse<CouponsVo> getOneByCouponId(String id) {
        CouponsVo couponsVo = new CouponsVo();
        couponsVo.setId(Long.parseLong(id));
        couponsVo.setName("测试优惠券");
        couponsVo.setAmout(new BigDecimal("100.99").setScale(2, BigDecimal.ROUND_HALF_UP));
        return CommonResponseUtil.successObj(couponsVo);
    }
}
